Page({
    data: {
      cardCur: 0,
      swiperList: [{
        id: 0,
        type: 'image',
        url: 'https://636c-cloud1-6gjo4km19da1d5c9-1309588362.tcb.qcloud.la/shot.png?sign=784f24c70162e15a59aef2138104cc5e&t=1657445124'
      }, {
        id: 1,
          type: 'image',
          url: 'https://636c-cloud1-6gjo4km19da1d5c9-1309588362.tcb.qcloud.la/1.jpg?sign=6e11ddf130e0dcc013ce99eaee955dad&t=1657446292',
      }, {
        id: 2,
        type: 'image',
        url: 'https://636c-cloud1-6gjo4km19da1d5c9-1309588362.tcb.qcloud.la/2.jpg?sign=4c617d0d55721447fa35c330050d0d83&t=1657446311'
      }, {
        id: 3,
        type: 'image',
        url: 'https://636c-cloud1-6gjo4km19da1d5c9-1309588362.tcb.qcloud.la/3.jpg?sign=68b98018596cc82593aca3d533deadb9&t=1657446323'
      }, {
        id: 4,
        type: 'image',
        url: 'https://636c-cloud1-6gjo4km19da1d5c9-1309588362.tcb.qcloud.la/4.jpg?sign=c3581297da33460d8f97a73d4ef7037e&t=1657446333'
      }, {
        id: 5,
        type: 'image',
        url: 'https://636c-cloud1-6gjo4km19da1d5c9-1309588362.tcb.qcloud.la/5.jpg?sign=ef51f25e2cb46d849eae3afdce4060f0&t=1657446347'
      }, ],
    },
    onLoad() {
      this.towerSwiper('swiperList');
      // 初始化towerSwiper 传已有的数组名即可
    },
    pai: function(){
        console.log("点击成功")
        wx.navigateTo({
        url: '/pages/tp/tp',
        })
      
      },
    chuan: function(){
        console.log("点击成功")
        wx.navigateTo({
        url: '/pages/ca/ca',
        })
      
      },
    DotStyle(e) {
      this.setData({
        DotStyle: e.detail.value
      })
    },
    // cardSwiper
    cardSwiper(e) {
      this.setData({
        cardCur: e.detail.current
      })
    },
    // towerSwiper
    // 初始化towerSwiper
    towerSwiper(name) {
      let list = this.data[name];
      for (let i = 0; i < list.length; i++) {
        list[i].zIndex = parseInt(list.length / 2) + 1 - Math.abs(i - parseInt(list.length / 2))
        list[i].mLeft = i - parseInt(list.length / 2)
      }
      this.setData({
        swiperList: list
      })
    },
    // towerSwiper触摸开始
    towerStart(e) {
      this.setData({
        towerStart: e.touches[0].pageX
      })
    },
    // towerSwiper计算方向
    towerMove(e) {
      this.setData({
        direction: e.touches[0].pageX - this.data.towerStart > 0 ? 'right' : 'left'
      })
    },
    // towerSwiper计算滚动
    towerEnd(e) {
      let direction = this.data.direction;
      let list = this.data.swiperList;
      if (direction == 'right') {
        let mLeft = list[0].mLeft;
        let zIndex = list[0].zIndex;
        for (let i = 1; i < list.length; i++) {
          list[i - 1].mLeft = list[i].mLeft
          list[i - 1].zIndex = list[i].zIndex
        }
        list[list.length - 1].mLeft = mLeft;
        list[list.length - 1].zIndex = zIndex;
        this.setData({
          swiperList: list
        })
      } else {
        let mLeft = list[list.length - 1].mLeft;
        let zIndex = list[list.length - 1].zIndex;
        for (let i = list.length - 1; i > 0; i--) {
          list[i].mLeft = list[i - 1].mLeft
          list[i].zIndex = list[i - 1].zIndex
        }
        list[0].mLeft = mLeft;
        list[0].zIndex = zIndex;
        this.setData({
          swiperList: list
        })
      }
    }
  })
